Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move connecting/disconnecting from service to onCreate/Destroy #471

Merged

Conversation

andreban
Copy link
Member

@andreban andreban commented May 17, 2024

The problem
I many cases, applications want to stay connected to the Custom Tabs service after the Custom Tabs is launched. They might want to listen for Custom Tabs callback events or enable a minimized tab to be replaced with a new one when relaunching. The existing code disconnects from the Custom Tabs service when the Activity is stopped, preventing either of those to happen.

The solution
Move binding and unbinding from the Custom Tabs Service to onCreate() / onDestroy(), so the application will stay connected to the service after it is backgrounded, allowing it to continue receiving callbacks and replace a minimized Custom Tab.

When using minimized Custom Tabs, if a Custom Tab is-relaunched
while a previous one is minimized, while connected to the Custom
Tabs service, the existing minimized tab will be killed and a
new one launched.
Copy link
Contributor

@PEConn PEConn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good, but could you add a bit more to the description - you say what goes wrong, but not how this change fixes it.

@andreban
Copy link
Member Author

Code changes look good, but could you add a bit more to the description - you say what goes wrong, but not how this change fixes it.

Updated the PR description. PTAL.

@PEConn
Copy link
Contributor

PEConn commented May 21, 2024

Amazing, LGTM, thanks.

@andreban andreban merged commit 2945ee4 into GoogleChrome:main May 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants